package com.xinruke.hostels.reservation.interfaces.api;

import com.xinruke.hostels.common.vo.ResultVO;
import com.xinruke.hostels.common.vo.query.RowsDataVO;
import com.xinruke.hostels.reservation.interfaces.dto.*;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import javax.validation.Valid;
import java.math.BigDecimal;
import java.util.List;

/**
 * @author GuoZheng
 * @ClassName ReservationApi
 * @date：2019/6/21
 * @version: 1.0
 * @description：预订API
 */
@FeignClient(value = "reservation-service", fallbackFactory = ReservationFallback.class)
public interface ReservationApi {


    @PostMapping("/discounts/if")
    @ApiOperation("查询人员是否可以优惠")
    ResultVO<BigDecimal> ifCanDiscounts(@Valid @RequestBody DiscountsIfCanQueryDTO params);

    /**
     * 1.入住更新优惠次数
     * 1.1通过用户入住时间和预离店时间计算次数，减少优惠次数和预订中次数（入住时调用），并添加记录信息。
     *
     * @return
     */
    @PostMapping("/discounts/check-in")
    @ApiOperation("入住更新优惠次数")
    ResultVO checkIn(@Valid @RequestBody List<DiscountsCheckInQueryDTO> params);

    /**
     * 1.提前退房补优惠
     * 1.1通过退房时间增加指定用户优惠次数（提前退房时调用）
     *
     * @return
     */
    @PostMapping("/discounts/make-up")
    @ApiOperation("提前退房补优惠")
    ResultVO makeUp(@Valid @RequestBody List<DiscountsMakeUpQueryDTO> params);

    /**
     * 1.新增联系人初始化优惠
     * 1.1 新增联系人用户绑定优惠接口，通过证件号判断是否需要插入数据
     *
     * @return
     */
    @PostMapping("/discounts/add")
    @ApiOperation("新增联系人初始化优惠")
    ResultVO addDiscounts(@Valid @RequestBody DiscountsAddQueryDTO params);

    @PostMapping("/discounts/remaining")
    @ApiOperation("查询人员剩余可优惠次数")
    ResultVO<Integer> remaining(@Valid @RequestBody DiscountsRemainingQueryDTO params);

    /**
     * 1.查询人员优惠记录
     * 1.1通过联系人或会员的证件号查询该人的优惠记录，展示关联订单信息，时间
     *
     * @return
     */
    @PostMapping("/discounts/record")
    @ApiOperation("查询人员优惠记录")
    ResultVO<RowsDataVO<DiscountsRecordQueryResultDTO>> record(@Valid @RequestBody DiscountsRecordQueryDTO params);

}
